home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
disasm.zip
/
UASM.DOC
< prev
next >
Wrap
Text File
|
1988-06-03
|
25KB
|
521 lines
UASM.DOC
UASM (for Unassembler) consists of five files at this time:
UASM.DOC, UASM-JMP.BAS, UASM-INT.BAS, UASM-STR.BAS and UASM-
DOS.MAC, with the purpose of converting the unassembled listing
of a .COM file from DEBUG into a .ASM file which can be modified
and re-assembled with the Macro assembler.
**************************** NOTICE *****************************
USER SUPPORTED SOFTWARE (With thanks to Andrew Flugelman)
A limited license is granted to all users of these programs,
to make and distribute copies for other users subject to the
following conditions:
1. None of the notices or credits are to be bypassed,
altered, or removed.
2. The programs are not to be distributed in modified form.
(Users are encouraged to distribute MERGE files.)
3. No fee is to be charged (or any other consideration
received) for copying or distributing the programs without
an express written agreement with White Crane Systems.
***************************************************************
UASM - The White Crane Systems Unassembler
If you are using these program and finding them of value
please send a cash contribution to support their upkeep and
distribution. Use the UASM system of programs to unassemble
one average length .COM file, look over the results and calculate
how many hours this would have taken you to produce. Multiply
this by the minimum wage, contribute that amount and use the
program free thereafter. If that's too much just send $20.
Supporters will receive free notice of enhancements and updates.
In any case you are encouraged to copy and distribute UASM
to your friends provided you do so free of charge and in unmodi-
fied form.
Guy C. Gordon
White Crane Systems
3194 Friar Tuck Way
Doraville, GA 30340
INTRODUCTION
The strategy used in this system is to capture the output
of DEBUG and run it through a series of BASIC programs, each
of which modifies one type of statement in the listing, making
it more like an .ASM source file. This keeps each program short
and fast, and allows you to look over the output at each step
to make sure no mistakes have been entered. It also makes the
programs easy to understand and improve as new steps can be
added without interfering with the first steps. Later in its
development UASM will combine these steps. I hope that users
of these programs will send me their improvements so that I
may add them to future releases.
UASM-JMP takes captured unassembled code from DEBUG (which
we will name FILE.DB) and finds all addresses referenced by
the various Jump, Call, and Loop instructions. These referenced
addresses are made into labels of the form Lhhhh (where hhhh
is the hex address). A new file (FILE.JMP) is then written
in the form of assembler source code. All of the addresses
and hex opcodes in the left two columns of the DEBUG listing
are left out. Referenced lines are appropriately labeled as
Lhhhh:. In addition, unconditional program transfers such as
JMP, JMPS, RET and IRET have blank lines inserted after them.
If the next line is not referenced it will be force labeled,
and a warning comment will be appended. The line after a RET
or IRET is most likely the beginning of a Procedure, and is
preceeded by three blank lines.
UASM-INT reads FILE.JMP and writes FILE.INT in which it
has added Macro calls and comments explaining the various Inter-
rupts. The macros, symbols, and comments are read from the
file UASM-DOS.MAC. This file contains a table of EQUates which
define the symbols for the various DOS function calls and the
DOSCALL macro. It is included in FILE.INT by means of an INCLUDE
directive.
UASM-STR reads FILE.INT and writes FILE.STR. Whenever it
encounters a DOSCALL PRINT$ hhhh it reads the string beginning
at hhhh from the original .COM file and prints it as a comment
beside the macro call. It also generates a Dhhhh: DB 'string'
instruction at the end of the file. Carriage Returns, Line
Feeds, TABs and ESCapes are expressed as symbols. All other
non-printing characters are expressed as hex data bytes. Because
this will not catch all text strings in the file, you are also
allowed to specify ranges of DEBUG addresses in which UASM-STR
is to find all the strings it can. Whenever the code loads
the DX register with the address of one of these strings, that
address is converted to a label and the string is added to the
line as a comment.
From that point on, you must take over and supply the remain-
ing text strings and variables that are addressed. You should
heavily comment the code as you go through it and change the
labels that UASM has assigned into more meaningful names. This
is best done with the global change command in your text editor.
I also recommend using the Macro CREF program to obtain a cross
reference map of the symbols.
These programs are by no means infallible, and they can
no more read the programmers' mind than you or I, so you will
have to check the output closely. If you expect to simply run
UASM and be handed a usable source file you're going to be disap-
pointed. On the other hand, if you've ever tried to understand
a program from just a DEBUG listing you will be pleasantly sur-
prised. UASM will aid you in studying other programs by doing
a lot of the dirty work for you, but if you don't study the
code you won't get usable output. For example an interrupt
handling subroutine will not necessarily be assigned a label
by UASM-JMP since it is not accessed by a Jump but by an inter-
rupt. Therefore if you find a DOSCALL SET$INT hhhh in the UASM-
INT output you must check to see if the label Lhhhh was gener-
ated. If not will have to go back to the DEBUG output to find
the routine at address hhhh and assign it a label of your own.
At present, UASM-INT only keeps track of the AX, AH, AL,
DX, and DL registers. Future improvements will involve a more
complete (and much more complicated) DOSCALL macro in the UASM-
DOS.MAC file and the proper calling of it by UASM-INT. For
now, keep a close eye on the interrupts.
I have been using these programs to unassemble DEBUG.COM
and COMMAND.COM. When I have them sufficiently commented I
will post them on the BBS's. At present I use mainly the Multi-
Link BBS at (404) 252-9438. It is my hope that UASM will lead
to a whole library of well commented, "reverse engineered" source
code for the MS-DOS operating system and utilities. I would
appreciate anyone else working on the same to upload your results
to the BBS. Suggestions and improvements are welcome. Please
post them on the MultiLink BBS or send them directly to:
Guy C. Gordon
White Crane Systems
3194 Friar Tuck Way
Doraville, GA 30340
OPERATING INSTRUCTIONS
-DEBUG-
As an example, we will unassemble a fictitious file, FILE.COM
A>debug file.com
-r
.....CX=1780 ... ;file length in hex bytes
-d 100 l 1780